// pages/user/user.js
var app = getApp();
var url = app.globalData.url;
var userId;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    user_info:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    userId = wx.getStorageSync('user_id');
    // console.log(userId);
    wx.setNavigationBarTitle({
      title: '个人中心'
    })
    // console.log(userId);
    var that = this;
    wx.request({
      url: url + '/api/user/user_index',
      method:'POST',
      data:{
        user_id : userId,
      },
      success:function(res){
        console.log(res);
        that.setData({
          user_info: res.data.user,
        })
      }
    })
  },

  waitpay:function(){
    wx.navigateTo({
      url: '/pages/orderlist/orderlist?type=WAITPAY'
    })
  },
  myAddress:function(){
    wx.navigateTo({
      url: '/pages/sitelist/sitelist',
    })
  },
  waitreceive:function(){
    wx.navigateTo({
      url: '/pages/orderlist/orderlist?type=WAITSEND'
    })
  },
  waitcomment:function(){
    wx.navigateTo({
      url: '/pages/orderlist/orderlist?type=WAITCCOMMENT'
    })
  },
  myOrder:function(){
    wx.navigateTo({
      url: '/pages/orderlist/orderlist?type=""'
    })
  }
})